package com.yuanxing.oushangyidali
import android.R
import com.fhx.core.AppContext
import com.fhx.core.utils.EventBusManager
import com.hjq.toast.ToastUtils
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.layout.SmartRefreshLayout

import org.greenrobot.eventbus.meta.SubscriberInfoIndex

class MyApp : AppContext() {
    companion object {
        lateinit var context: MyApp
    }

    override fun onCreate() {
        super.onCreate()
        context = this
        val eventBusIndexList = ArrayList<SubscriberInfoIndex>()
//        eventBusIndexList.add(MyAppEventBusIndex())
        eventBusIndexList.add(MyCoreEventBusIndex())
        EventBusManager.init(eventBusIndexList)
        //设置全局默认配置（优先级最低，会被其他设置覆盖）
        SmartRefreshLayout.setDefaultRefreshInitializer { context, layout -> //全局设置（优先级最低）
            // layout.setEnableAutoLoadMore(true)
            layout.setEnableOverScrollDrag(false)
            layout.setEnableOverScrollBounce(true)
            layout.setEnableLoadMoreWhenContentNotFull(false)
            layout.setEnableScrollContentWhenRefreshed(true)
//            white
            layout.setPrimaryColorsId(R.color.holo_blue_dark, R.color.holo_blue_dark)
            layout.setFooterMaxDragRate(4.0f)
            layout.setFooterHeight(45f)

        }
        SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
            ClassicsFooter(
                context
            ).setDrawableSize(20f)
        }
        ToastUtils.init(this)


    }

}